﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.MODEL.FoundationModel;
using MINERP.NEWPhotoRindGrid.IView;
using MINERP.NEWPhotoRindGrid.Presenter;
namespace MINERP.NEWPhotoRindGrid
{
    public partial class FrmSelectSubarea : Form, ISelectSubAreaView
    {

        SelectSubAreaPresenter _presenter;
        public FrmSelectSubarea()
        {
            InitializeComponent();       
        }

        private void comboBox_SelectSubarea_SelectionChangeCommitted(object sender, EventArgs e)
        {
            _presenter.SelectEd();
        }


        #region ISelectSubAreaView 成员



        public void BindSubArea(List<GridSubArea_Info> ListSource)
        {
            comboBox_SelectSubarea.DataSource = ListSource;
            comboBox_SelectSubarea.DisplayMember = "SubAreaName";
            comboBox_SelectSubarea.ValueMember = "SubAreaID";
        }

        public void CloseFrm()
        {
            this.DialogResult = DialogResult.OK;
        }

        public int SelectSubAreaId
        {
            get { return (int)comboBox_SelectSubarea.SelectedValue; }
        }

        #endregion

        private void FrmSelectSubarea_Load(object sender, EventArgs e)
        {
            _presenter = new SelectSubAreaPresenter(this);
        }

        private void FrmSelectSubarea_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.DialogResult!=DialogResult.OK)
            {
                e.Cancel = true;
            }
        }
    }
}
